<template>
  <div class="today-recommend" id="recommend">
    <div class="py-container">
      <ul class="recommend">
        <li class="clock">
          <div class="time" @click="getRecommend">
            <img src="./images/clock.png" alt=""/>
            <h3>为你推荐</h3>
          </div>
        </li>
        <li v-for="item in car" :key="item.id" style="width:20.83%"><img style="width:100%;height:165px" :src="item.carCover" @click="detail(item.carId)"></li>
        <!-- <li class="banner">
          <img src="./images/img.png" alt=""/>
        </li>
        <li class="banner">
          <img src="./images/img.png" alt=""/>
        </li>
        <li class="banner">
          <img src="./images/img.png" alt=""/>
        </li>
        <li class="banner">
          <img src="./images/img.png" alt=""/>
        </li> -->
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: "index",
  data(){
    return{
      car:[]
    }
  },
  methods:{
    getRecommend(){
    this.$axios.get("/client/carRecommend").then(res =>{
      this.car = res.data.data
    })
  },
  detail(id){
      console.log(666)
    const ARTICLE_URL = "http://101.43.12.19/#/car/detail/" + id;
            //return ARTICLE_URL;
            window.open(ARTICLE_URL, "_blank")
      console.log(id)
  }
  },
  created(){
    this.getRecommend()
  }
}
</script>

<style lang="less" scoped>
.today-recommend {
  .py-container {
    width: 1200px;
    margin: 0 auto;

    .recommend {
      height: 165px;
      background-color: #eaeaea;
      margin: 10px 0;
      display: flex;

      .clock {
        width: 16.67%;
        background-color: #5c5251;
        color: #fff;
        font-size: 18px;
        text-align: center;

        .time {
          padding: 28px 17px;
          width: 165px;
        }

        h3 {
          margin: 9px 0;
          font-weight: 700;
          font-size: 18px;
          line-height: 30.06px;
        }
      }

      .banner {
        width: 20.83%;

        img {
          width: 165px;
          height: 165px;
          transition: all 400ms;

          &:hover {
            opacity: 0.8;
          }
        }
      }
    }
  }
}
</style>
